<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="zh">
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
	<title>客户资源管理系统</title>
	<!-- 标签图标设置 -->
	<link rel="icon" href="${pageContext.request.contextPath }/images/favicon.ico" type="image/ico">
	<!-- SEO（搜索引擎所有关键件） -->
	<meta name="keywords" content="crm,qf">
	<meta name="description" content="这是一个解决中小企业客户资源管理的网站">
	<meta name="author" content="枫桥夜泊1990">
	<link href="${pageContext.request.contextPath }/css/bootstrap.min.css" rel="stylesheet">
	<link href="${pageContext.request.contextPath }/css/materialdesignicons.min.css" rel="stylesheet">
	<link href="${pageContext.request.contextPath }/css/style.min.css" rel="stylesheet">
	<link rel="stylesheet" href="${pageContext.request.contextPath }/js/jconfirm/jquery-confirm.min.css">
</head>
  
<body>
<%
	Integer empId = (Integer)session.getAttribute("empId");
	String employeeName = (String)session.getAttribute("empName");
	if(empId==null || employeeName==null){
		response.sendRedirect("index.jsp");
	}
%>
<div class="lyear-layout-web">
  <div class="lyear-layout-container">
    <!--左侧导航-->
    <aside class="lyear-layout-sidebar">
      
      <!-- logo -->
      <div id="logo" class="sidebar-header">
        <a href="${pageContext.request.contextPath }/HomeServlet"><img src="${pageContext.request.contextPath }/images/logo-sidebar.png" title="LightYear" alt="LightYear" /></a>
      </div>
      <div class="lyear-layout-sidebar-scroll"> 
        
        <!-- 侧边栏开始 -->
        <jsp:include page="common/menus.jsp"></jsp:include>
        <!-- 侧边栏结束 -->
        
         <div class="sidebar-footer">
           <p class="copyright">Copyright &copy; 2020. <img style="width: 25px;padding-bottom: 5px;" src="images/fy.png" /> <a target="_blank" href="https://hd1611756908.github.io/"> CRM</a>&nbsp; Powered By &nbsp;<a href="https://space.bilibili.com/514155929/" target="_blank" title="枫桥夜泊">枫桥夜泊</a></p>
         </div>
      </div>
      
    </aside>
    <!--End 左侧导航-->
    
    <!--头部信息-->
    <header class="lyear-layout-header">
      
      <nav class="navbar navbar-default">
        <div class="topbar">
          
          <div class="topbar-left">
            <div class="lyear-aside-toggler">
              <span class="lyear-toggler-bar"></span>
              <span class="lyear-toggler-bar"></span>
              <span class="lyear-toggler-bar"></span>
            </div>
            <span class="navbar-page-title"> 合同 - 合同列表 </span>
          </div>
          
          <ul class="topbar-right">
            
            
            <!-- 用户信息start -->
            <jsp:include page="common/userinfo.jsp"></jsp:include>
            <!-- 用户信息start -->
            
            <!--切换主题配色-->
		    <li class="dropdown dropdown-skin">
			  <span data-toggle="dropdown" class="icon-palette"><i class="mdi mdi-palette"></i></span>
			  <ul class="dropdown-menu dropdown-menu-right" data-stopPropagation="true">
                <li class="drop-title"><p>主题</p></li>
                <li class="drop-skin-li clearfix">
                  <span class="inverse">
                    <input type="radio" name="site_theme" value="default" id="site_theme_1" checked>
                    <label for="site_theme_1"></label>
                  </span>
                  <span>
                    <input type="radio" name="site_theme" value="dark" id="site_theme_2">
                    <label for="site_theme_2"></label>
                  </span>
                  <span>
                    <input type="radio" name="site_theme" value="translucent" id="site_theme_3">
                    <label for="site_theme_3"></label>
                  </span>
                </li>
			    <li class="drop-title"><p>LOGO</p></li>
				<li class="drop-skin-li clearfix">
                  <span class="inverse">
                    <input type="radio" name="logo_bg" value="default" id="logo_bg_1" checked>
                    <label for="logo_bg_1"></label>
                  </span>
                  <span>
                    <input type="radio" name="logo_bg" value="color_2" id="logo_bg_2">
                    <label for="logo_bg_2"></label>
                  </span>
                  <span>
                    <input type="radio" name="logo_bg" value="color_3" id="logo_bg_3">
                    <label for="logo_bg_3"></label>
                  </span>
                  <span>
                    <input type="radio" name="logo_bg" value="color_4" id="logo_bg_4">
                    <label for="logo_bg_4"></label>
                  </span>
                  <span>
                    <input type="radio" name="logo_bg" value="color_5" id="logo_bg_5">
                    <label for="logo_bg_5"></label>
                  </span>
                  <span>
                    <input type="radio" name="logo_bg" value="color_6" id="logo_bg_6">
                    <label for="logo_bg_6"></label>
                  </span>
                  <span>
                    <input type="radio" name="logo_bg" value="color_7" id="logo_bg_7">
                    <label for="logo_bg_7"></label>
                  </span>
                  <span>
                    <input type="radio" name="logo_bg" value="color_8" id="logo_bg_8">
                    <label for="logo_bg_8"></label>
                  </span>
				</li>
				<li class="drop-title"><p>头部</p></li>
				<li class="drop-skin-li clearfix">
                  <span class="inverse">
                    <input type="radio" name="header_bg" value="default" id="header_bg_1" checked>
                    <label for="header_bg_1"></label>                      
                  </span>                                                    
                  <span>                                                     
                    <input type="radio" name="header_bg" value="color_2" id="header_bg_2">
                    <label for="header_bg_2"></label>                      
                  </span>                                                    
                  <span>                                                     
                    <input type="radio" name="header_bg" value="color_3" id="header_bg_3">
                    <label for="header_bg_3"></label>
                  </span>
                  <span>
                    <input type="radio" name="header_bg" value="color_4" id="header_bg_4">
                    <label for="header_bg_4"></label>                      
                  </span>                                                    
                  <span>                                                     
                    <input type="radio" name="header_bg" value="color_5" id="header_bg_5">
                    <label for="header_bg_5"></label>                      
                  </span>                                                    
                  <span>                                                     
                    <input type="radio" name="header_bg" value="color_6" id="header_bg_6">
                    <label for="header_bg_6"></label>                      
                  </span>                                                    
                  <span>                                                     
                    <input type="radio" name="header_bg" value="color_7" id="header_bg_7">
                    <label for="header_bg_7"></label>
                  </span>
                  <span>
                    <input type="radio" name="header_bg" value="color_8" id="header_bg_8">
                    <label for="header_bg_8"></label>
                  </span>
				</li>
				<li class="drop-title"><p>侧边栏</p></li>
				<li class="drop-skin-li clearfix">
                  <span class="inverse">
                    <input type="radio" name="sidebar_bg" value="default" id="sidebar_bg_1" checked>
                    <label for="sidebar_bg_1"></label>
                  </span>
                  <span>
                    <input type="radio" name="sidebar_bg" value="color_2" id="sidebar_bg_2">
                    <label for="sidebar_bg_2"></label>
                  </span>
                  <span>
                    <input type="radio" name="sidebar_bg" value="color_3" id="sidebar_bg_3">
                    <label for="sidebar_bg_3"></label>
                  </span>
                  <span>
                    <input type="radio" name="sidebar_bg" value="color_4" id="sidebar_bg_4">
                    <label for="sidebar_bg_4"></label>
                  </span>
                  <span>
                    <input type="radio" name="sidebar_bg" value="color_5" id="sidebar_bg_5">
                    <label for="sidebar_bg_5"></label>
                  </span>
                  <span>
                    <input type="radio" name="sidebar_bg" value="color_6" id="sidebar_bg_6">
                    <label for="sidebar_bg_6"></label>
                  </span>
                  <span>
                    <input type="radio" name="sidebar_bg" value="color_7" id="sidebar_bg_7">
                    <label for="sidebar_bg_7"></label>
                  </span>
                  <span>
                    <input type="radio" name="sidebar_bg" value="color_8" id="sidebar_bg_8">
                    <label for="sidebar_bg_8"></label>
                  </span>
				</li>
			  </ul>
			</li>
            <!--切换主题配色-->
          </ul>
          
        </div>
      </nav>
      
    </header>
    <!--End 头部信息-->
    
    <!--页面主要内容-->
    <main class="lyear-layout-content">
      
      <div class="container-fluid">
        
        
        <div class="row">
		  <div class="col-lg-12">
			<div class="card">
			  <div class="card-toolbar clearfix">
				<form class="pull-right search-bar" method="get" action="#!" role="form">
				  <div class="input-group">
					<input id="searchValue" type="text" class="form-control" name="keyword" placeholder="请输入合同">
					<div class="input-group-btn">
					  <button id="searchBtn" class="btn btn-dark" type="button">搜索</button>
					</div>
				  </div>
				</form>
				<div class="toolbar-btn-action">
				  <a class="btn btn-primary m-r-5" href="${pageContext.request.contextPath }/ContractAddJumpServlet"><i class="mdi mdi-plus"></i> 新增</a>
				  <a id="btnDel" class="btn btn-danger" href="#!"><i class="mdi mdi-window-close"></i> 删除</a>
				</div>
			  </div>
			  <div class="card-body">
				
				<div class="table-responsive">
				  <table class="table table-hover">
					<thead>
					  <tr>
						<th>
						  <label class="lyear-checkbox checkbox-primary">
							<input type="checkbox" id="check-all"><span></span>
						  </label>
						</th>
						<th>合同编号</th>
						<th>合同名称</th>
						<th>客户名称</th>
						<th>合同金额</th>
						<th>生效时间</th>
						<th>结束时间</th>
						<th>客户签约人</th>
						<th>公司签约人</th>
						<th>负责人</th>
						<th>审批人1</th>
						<th>审批人2</th>
						<th>状态</th>
					  </tr>
					</thead>
					<tbody id="tbody">
					</tbody>
				  </table>
				</div>
				<ul class="pagination" id="showPage"></ul>
			  </div>
			</div>
		  </div>
		  
		</div>
       
     
        
      </div>
      
    </main>
    <!--End 页面主要内容-->
  </div>
</div>

<!-- 合同状态start -->
<div id="showModel"></div>
<!-- 合同状态end -->

<script type="text/javascript" src="${pageContext.request.contextPath }/js/jquery.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/js/bootstrap.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/js/perfect-scrollbar.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/js/main.min.js"></script>
<!--图表插件-->
<script type="text/javascript" src="${pageContext.request.contextPath }/js/Chart.js"></script>
<script src="${pageContext.request.contextPath }/js/jconfirm/jquery-confirm.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/js/pdfobject.min.js"></script>
<script type="text/javascript">

	/* 模糊查询 */
	$("#searchBtn").click(function(){
		//获取搜索框中的输入值
		var searchValue = $("#searchValue").val();
		//发送AJAX请求向后台获取数据
		$.getJSON("${pageContext.request.contextPath}/ContractSearchLikeServlet",{searchValue:searchValue},function(d){
			console.log(d);
			var p=d;
			var str="";
			for(var i=0;i<p.length;i++){
				str+="<tr>\r\n" + 
				"						<td>\r\n" + 
				"						  <label class=\"lyear-checkbox checkbox-primary\">\r\n" + 
				"							<input type=\"checkbox\" name=\"ids[]\" value=\""+p[i].contractId+"\"><span></span>\r\n" + 
				"						  </label>\r\n" + 
				"						</td>\r\n" + 
				"						<td><a class='onStatus' href=\"#\" data-toggle=\"modal\" data-target=\"#gridSystemModal\">"+p[i].contractId+"</a></td>\r\n" + 
				"						<td><a class=\"contractClass\" href='http://localhost:8080/crm"+p[i].contractUrl+"'>"+p[i].contractName+"</a></td>\r\n" + 
				"						<td>"+p[i].customer.customerName+"</td>\r\n" + 
				"						<td>"+p[i].contractMoney+"</td>\r\n" + 
				"						<td>"+p[i].startTime+"</td>\r\n" + 
				"						<td>"+p[i].endTime+"</td>\r\n" + 
				"						<td>"+p[i].customerSigner+"</td>\r\n" + 
				"						<td>"+p[i].employeeSigner.employeeName+"</td>\r\n" + 
				"						<td>"+p[i].employeeResponsible.employeeName+"</td>\r\n" + 
				"						<td>"+p[i].employee01.employeeName+"</td>\r\n" + 
				"						<td>"+p[i].employee02.employeeName+"</td>\r\n" + 
				"						<td>"+isTro(p[i].flag)+"</td>\r\n" + 
				"					  </tr>";
			}
			//console.log(str);
			$("#tbody").html(str);
			
		});
	});


	
	/* 查看pdf文件 */
	$(".contractClass").click(function(){
		PDFObject.embed(this.href);
	});
	
	/* 
		查询合同列表
	*/
	var pageNo=1;
	var pageSize=2;
	var pageCount=1;
	$.getJSON("ContractListJsonServlet",{pageNo:pageNo,pageSize:pageSize},function(d){
		console.log(d);
		//更新分页数据
		pageCount=d.pageCount;
		//合同列表
		var p = d.obj;
		var str="";
		for(var i=0;i<p.length;i++){
			str+="<tr>\r\n" + 
			"						<td>\r\n" + 
			"						  <label class=\"lyear-checkbox checkbox-primary\">\r\n" + 
			"							<input type=\"checkbox\" name=\"ids[]\" value=\""+p[i].contractId+"\"><span></span>\r\n" + 
			"						  </label>\r\n" + 
			"						</td>\r\n" + 
			"						<td><a class='onStatus' href=\"#\" data-toggle=\"modal\" data-target=\"#gridSystemModal\">"+p[i].contractId+"</a></td>\r\n" + 
			"						<td><a class=\"contractClass\" href='http://localhost:8080/crm"+p[i].contractUrl+"'>"+p[i].contractName+"</a></td>\r\n" + 
			"						<td>"+p[i].customer.customerName+"</td>\r\n" + 
			"						<td>"+p[i].contractMoney+"</td>\r\n" + 
			"						<td>"+p[i].startTime+"</td>\r\n" + 
			"						<td>"+p[i].endTime+"</td>\r\n" + 
			"						<td>"+p[i].customerSigner+"</td>\r\n" + 
			"						<td>"+p[i].employeeSigner.employeeName+"</td>\r\n" + 
			"						<td>"+p[i].employeeResponsible.employeeName+"</td>\r\n" + 
			"						<td>"+p[i].employee01.employeeName+"</td>\r\n" + 
			"						<td>"+p[i].employee02.employeeName+"</td>\r\n" + 
			"						<td>"+isTro(p[i].flag)+"</td>\r\n" + 
			"					  </tr>";
		}
		//console.log(str);
		$("#tbody").html(str);
		//进度列表
		
		joinPage(pageNo,pageCount);
		showStyle(pageNo,".showStyle");
		bindPage(pageNo,pageCount);
		onStatus();
	});
	
	
	
	/* 分页样式设置 */
	function showStyle(pageNo,classStyle){
		var css = $(classStyle);
		for(var i=0;i<css.length;i++){
			var pn = css[i].innerHTML;
			if(pn == pageNo){
				$(css[i]).parent().addClass("active");
			}
		}
	}
	
	/* 拼接分页 */
	function joinPage(pageNo,pageCount){
		var str="<li><a id='pre' href='#'>«</a></li>";
		if(pageCount<=3){
			for(var i=1;i<=pageCount;i++){
				str+="<li><a class='showStyle' href=\"#\">"+i+"</a></li>";
			}
		}else{
			//pageNo<=3
			if(pageNo<=3){
				for(var i=1;i<=3;i++){
					str+="<li><a class='showStyle' href=\"#\">"+i+"</a></li>";
				}
			}else{//pageNo>3
				for(var i=pageNo-2;i<=pageNo;i++){
					str+="<li><a class='showStyle' href=\"#\">"+i+"</a></li>";
				}
			}
		}
		str+="<li><a id='next' href=\"#\">»</a></li>";
		//将拼接好的分页信息设置到指定位置
		$("#showPage").html(str);
	}
	
	/* 事件绑定 */
	function bindPage(pageNo,pageCount){
		
		//绑定上一页
		$("#pre").click(function(){
			if(pageNo<=1){
				alert("已经是第一页");
			}else{
				pageNo=pageNo-1;

				$.getJSON("ContractListJsonServlet",{pageNo:pageNo,pageSize:pageSize},function(d){
					console.log(d);
					//更新分页数据
					pageCount=d.pageCount;
					//合同列表
					var p = d.obj;
					var str="";
					for(var i=0;i<p.length;i++){
						str+="<tr>\r\n" + 
						"						<td>\r\n" + 
						"						  <label class=\"lyear-checkbox checkbox-primary\">\r\n" + 
						"							<input type=\"checkbox\" name=\"ids[]\" value=\""+p[i].contractId+"\"><span></span>\r\n" + 
						"						  </label>\r\n" + 
						"						</td>\r\n" + 
						"						<td><a class='onStatus' href=\"#\">"+p[i].contractId+"</a></td>\r\n" + 
						"						<td><a class=\"contractClass\" href='http://localhost:8080/crm"+p[i].contractUrl+"'>"+p[i].contractName+"</a></td>\r\n" + 
						"						<td>"+p[i].customer.customerName+"</td>\r\n" + 
						"						<td>"+p[i].contractMoney+"</td>\r\n" + 
						"						<td>"+p[i].startTime+"</td>\r\n" + 
						"						<td>"+p[i].endTime+"</td>\r\n" + 
						"						<td>"+p[i].customerSigner+"</td>\r\n" + 
						"						<td>"+p[i].employeeSigner.employeeName+"</td>\r\n" + 
						"						<td>"+p[i].employeeResponsible.employeeName+"</td>\r\n" + 
						"						<td>"+p[i].employee01.employeeName+"</td>\r\n" + 
						"						<td>"+p[i].employee02.employeeName+"</td>\r\n" + 
						"						<td>"+isTro(p[i].flag)+"</td>\r\n" + 
						"					  </tr>";
					}
					//console.log(str);
					$("#tbody").html(str);
					//进度列表
					
					joinPage(pageNo,pageCount);
					showStyle(pageNo,".showStyle");
					bindPage(pageNo,pageCount);
					onStatus();
				});
			}
		});
		
		$("#next").click(function(){
			if(pageNo>=pageCount){
				alert("已经是最后一页");
			}else{
				pageNo=pageNo+1;
				$.getJSON("ContractListJsonServlet",{pageNo:pageNo,pageSize:pageSize},function(d){
					console.log(d);
					//更新分页数据
					pageCount=d.pageCount;
					//合同列表
					var p = d.obj;
					var str="";
					for(var i=0;i<p.length;i++){
						str+="<tr>\r\n" + 
						"						<td>\r\n" + 
						"						  <label class=\"lyear-checkbox checkbox-primary\">\r\n" + 
						"							<input type=\"checkbox\" name=\"ids[]\" value=\""+p[i].contractId+"\"><span></span>\r\n" + 
						"						  </label>\r\n" + 
						"						</td>\r\n" + 
						"						<td><a class='onStatus' href=\"#\">"+p[i].contractId+"</a></td>\r\n" + 
						"						<td><a class=\"contractClass\" href='http://localhost:8080/crm"+p[i].contractUrl+"'>"+p[i].contractName+"</a></td>\r\n" + 
						"						<td>"+p[i].customer.customerName+"</td>\r\n" + 
						"						<td>"+p[i].contractMoney+"</td>\r\n" + 
						"						<td>"+p[i].startTime+"</td>\r\n" + 
						"						<td>"+p[i].endTime+"</td>\r\n" + 
						"						<td>"+p[i].customerSigner+"</td>\r\n" + 
						"						<td>"+p[i].employeeSigner.employeeName+"</td>\r\n" + 
						"						<td>"+p[i].employeeResponsible.employeeName+"</td>\r\n" + 
						"						<td>"+p[i].employee01.employeeName+"</td>\r\n" + 
						"						<td>"+p[i].employee02.employeeName+"</td>\r\n" + 
						"						<td>"+isTro(p[i].flag)+"</td>\r\n" + 
						"					  </tr>";
					}
					//console.log(str);
					$("#tbody").html(str);
					//进度列表
					
					joinPage(pageNo,pageCount);
					showStyle(pageNo,".showStyle");
					bindPage(pageNo,pageCount);
					onStatus();
				});
			}
		});
		
		var sss = $(".showStyle");
		for(var i=0;i<sss.length;i++){
			
			$(sss[i]).click(function(){
				
				//获取标签页
				var pn = this.innerHTML;
				pageNo=parseInt(pn);
				
				
				$.getJSON("ContractListJsonServlet",{pageNo:pageNo,pageSize:pageSize},function(d){
					console.log(d);
					//更新分页数据
					pageCount=d.pageCount;
					//合同列表
					var p = d.obj;
					var str="";
					for(var i=0;i<p.length;i++){
						str+="<tr>\r\n" + 
						"						<td>\r\n" + 
						"						  <label class=\"lyear-checkbox checkbox-primary\">\r\n" + 
						"							<input type=\"checkbox\" name=\"ids[]\" value=\""+p[i].contractId+"\"><span></span>\r\n" + 
						"						  </label>\r\n" + 
						"						</td>\r\n" + 
						"						<td><a class='onStatus' href=\"#\">"+p[i].contractId+"</a></td>\r\n" + 
						"						<td><a class=\"contractClass\" href='http://localhost:8080/crm"+p[i].contractUrl+"'>"+p[i].contractName+"</a></td>\r\n" + 
						"						<td>"+p[i].customer.customerName+"</td>\r\n" + 
						"						<td>"+p[i].contractMoney+"</td>\r\n" + 
						"						<td>"+p[i].startTime+"</td>\r\n" + 
						"						<td>"+p[i].endTime+"</td>\r\n" + 
						"						<td>"+p[i].customerSigner+"</td>\r\n" + 
						"						<td>"+p[i].employeeSigner.employeeName+"</td>\r\n" + 
						"						<td>"+p[i].employeeResponsible.employeeName+"</td>\r\n" + 
						"						<td>"+p[i].employee01.employeeName+"</td>\r\n" + 
						"						<td>"+p[i].employee02.employeeName+"</td>\r\n" + 
						"						<td>"+isTro(p[i].flag)+"</td>\r\n" + 
						"					  </tr>";
					}
					//console.log(str);
					$("#tbody").html(str);
					//进度列表
					joinPage(pageNo,pageCount);
					showStyle(pageNo,".showStyle");
					bindPage(pageNo,pageCount);
					onStatus();
				});
				
			});
			
		}
	}
	
	/* 查看状态 */
	function onStatus(){
		var bindOnStatus = $(".onStatus");
		for(var i=0;i<bindOnStatus.length;i++){
			$(bindOnStatus[i]).click(function(){
				
				//发送AJAX请求获取当前的合同的信息
				$.getJSON("ContractGetJsonServlet",{contractId:this.innerHTML},function(d){
					console.log(d);
					console.log(d.productList);
					var str="<div class=\"modal fade\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"gridSystemModalLabel\" id=\"gridSystemModal\">\r\n" + 
					"  <div class=\"modal-dialog\" role=\"document\">\r\n" + 
					"	<div class=\"modal-content\">\r\n" + 
					"	  <div class=\"modal-header\">\r\n" + 
					"		<button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-label=\"Close\"><span id='onX' aria-hidden=\"true\">&times;</span></button>\r\n" + 
					"		<h4 class=\"modal-title\" id=\"gridSystemModalLabel\">合同信息</h4>\r\n" + 
					"	  </div>\r\n" + 
					"	  <div class=\"modal-body\">\r\n" + 
					"		<div class=\"row\">\r\n" + 
					"		  <div class=\"col-md-12\">\r\n" + 
					"			  <ul class=\"nav-step step-anchor\">\r\n" + 
					"				<li class=\"nav-step-item\">\r\n" + 
					"				  <a href=\"#step-1\">\r\n" + 
					"					<h6>"+d.employeeResponsible.employeeName+"</h6>\r\n" + 
					"					<p class=\"m-0\">已提交</p>\r\n" + 
					"				  </a>\r\n" + 
					"				</li>\r\n" + 
					"				<li class=\"nav-step-item\">\r\n" + 
					"				  <a href=\"#step-2\">\r\n" + 
					"					<h6>"+d.employee01.employeeName+"</h6>\r\n" + 
					"					<p class=\"m-0\">"+(d.flag==1?'通过':d.flag==0?'未审批':'未通过')+"</p>\r\n" + 
					"				  </a>\r\n" + 
					"				</li>\r\n" + 
					"				<li class=\"nav-step-item\">\r\n" + 
					"				  <a href=\"#step-3\">\r\n" + 
					"					<h6>"+d.employee02.employeeName+"</h6>\r\n" + 
					"					<p class=\"m-0\">"+((d.flag==2 || d.flag==4)?'未通过':d.flag==3?'通过':'未审批')+"</p>\r\n" + 
					"				  </a>\r\n" + 
					"				</li>\r\n" + 
					"			  </ul>\r\n" + 
					"		  </div>\r\n" + 
					"		</div>\r\n" + 
					"		<div class=\"modal-header\">\r\n" + 
					"			<h4 class=\"modal-title\" id=\"gridSystemModalLabel\">产品列表</h4>\r\n" + 
					"		</div>\r\n" + 
					"		<div class=\"row\">\r\n" + 
					"		  <div class=\"col-md-12\">\r\n" + 
					"			  <table class=\"table\">\r\n" + 
					"				<thead>\r\n" + 
					"				  <tr>\r\n" + 
					"					<th>产品名称</th>\r\n" + 
					"					<th>产品编号</th>\r\n" + 
					"					<th>价格</th>\r\n" + 
					"					<th>数量</th>\r\n" + 
					"					<th>合计</th>\r\n" + 
					"				  </tr>\r\n" + 
					"				</thead>\r\n" + 
					"				<tbody>"+joinProductList(d.productList)+"</tbody>" + 
					"			  </table>\r\n" + 
					"		  </div>\r\n" + 
					"		</div>\r\n" + 
					"	  </div>\r\n" + 
					"	</div>\r\n" + 
					"  </div>\r\n" + 
					"</div>";
					
					$("#showModel").html(str);
					//手动开启
					$("#gridSystemModal").modal('show');
					$("#gridSystemModal").modal();//开启手动模态框设置
					$("#onX").click(function(){
						$("#gridSystemModal").modal('hide');
					});
				})
				return false;
			});
		}
	}
	
	function joinProductList(pList){
		var str="";
		for(var i=0;i<pList.length;i++){
			str+="<tr>\r\n" + 
			"					<th>"+pList[i].productName+"</th>\r\n" + 
			"					<td>"+pList[i].productCode+"</td>\r\n" + 
			"					<td>"+pList[i].price+"</td>\r\n" + 
			"					<td>100</td>\r\n" + 
			"					<td>2000</td>\r\n" + 
			"				  </tr>";
		}
		return str;
	}
	
	/* 
		进度
	*/
	function isTro(flag){
		if(flag==0){
			return '已提交'
		}else if(flag==1){
			return '审批人1通过'
		}else if(flag==2){
			return '审批人1未通过'
		}else if(flag==3){
			return '审批人2已通过'
		}else if(flag==4){
			return '审批人2未通过'
		}
	}
</script>
</body>
</html>